#include <iostream>
#include <algorithm>
#include "TestSortHelper.h"
#include "Student.h"

using namespace std;

template <typename T>
void selectionSort(T arrays[], int lenarray) {

    for (int i = 0;i < lenarray;i++) {

        int minindex = i;
        for (int j = i + 1;j < lenarray;j++) {
            if (arrays[j] < arrays[minindex]) {
                minindex = j;
            }
        }
        swap(arrays[i], arrays[minindex]);
    }
}

int main() {
    int arrays[10] = { 1,2,3,4,11,6,7,8,9,10 };
    selectionSort(arrays, 10);
    TestSortHelper::printArray(arrays, 10);

    float farrays[10] = { 1,2,3,4,11.1,6,7,8,9,10 };
    selectionSort(farrays, 10);
    TestSortHelper::printArray(farrays, 10);

    Student d[4] = { {"D",90} , {"C",100} , {"B",95} , {"A",95} };
    selectionSort(d, 4);
    TestSortHelper::printArray(d, 4);
    return 1;
}
int main2(){
    int n = 10000;
    int *arr = TestSortHelper::generateRandomArray(n, 0, n);
    TestSortHelper::testSort("selection Sort", selectionSort, arr, n);
    //TestSortHelper::printArray(arr, n);
    return 0;
}